// stores/menu.ts
import {defineStore} from 'pinia'
import {ref} from 'vue'

export const useMenuStore = defineStore('menu', () => {
    const activeTab = ref(0)
    const tabList = ref([
        {
            key: 'home',
            iconPath: '/static/icon/home.png',
            selectedIconPath: '/static/icon/home1.png',
            pagePath: "/pages/index/index"
        },
        {
            key: 'category',
            iconPath: '/static/icon/moments.png',
            selectedIconPath: '/static/icon/moments1.png',
            pagePath: "/pages/index/view"
        },
        {
            key: 'cart',
            iconPath: '/static/icon/activity.png',
            selectedIconPath: '/static/icon/activity1.png',
            pagePath: "/pages/index/message"
        },
        {
            key: 'mine',
            iconPath: '/static/icon/me.png',
            selectedIconPath: '/static/icon/me1.png',
            pagePath: "/pages/index/user"
        }
    ])

    function setActive(index: number) {
        activeTab.value = index
    }

    return {
        activeTab,
        tabList,
        setActive
    }
})